package nexus.list
{
	public class Ary extends Array
	{
		
		private var C : Class;
		private var gc : Array = [];
		
		public function Ary( $Class : Class )
		{
			super();
			
			C = $Class;
		}
		
		public function get():Object
		{
			if( gc.length > 0 ) return gc.pop();
			else
			{
				var o : Object = new C();
				this.push( o );
				return o;
			}
		}
		
		public function reset():void
		{
			var len:int = this.length;
			for (var i:int = 0; i < len; i++) 
			{
				gc.push( this[ i ] );
			}
			
			this.length = 0;
		}
	}
}



